import request from '@/config/axios'

// 运维工单 VO
export interface RobotOperationVO {
  id: number // 主键
  libraryId: string // 图书馆id
  source: number // 来源渠道 (source): [1电话/2邮件/3系统上报/4APP/5微信等]
  robotType: string // 机器人类型
  robotId: number // 机器人id
  robotCode: string // 机器人编号
  robotName: string // 机器人名称
  status: number // 当前状态 (status): [1待分配/2已分配/3处理中/4待确认/5已完成/6已关闭/7已取消]
  priority: string // 优先级 (priority): [P0-P4]
  productModel: string // 产品型号
  errorCode: string // 故障代码
  severity: string // 故障级别 (severity): [致命/严重/一般/轻微]
  failureTime: Date // 故障发生时间
  primaryEngineer: string // 主要工程师
}

// 运维工单 API
export const RobotOperationApi = {
  // 查询运维工单分页
  getRobotOperationPage: async (params: any) => {
    return await request.get({ url: `/health/robot-operation/page`, params })
  },

  // 查询运维工单详情
  getRobotOperation: async (id: number) => {
    return await request.get({ url: `/health/robot-operation/get?id=` + id })
  },

  // 新增运维工单
  createRobotOperation: async (data: RobotOperationVO) => {
    return await request.post({ url: `/health/robot-operation/create`, data })
  },

  // 修改运维工单
  updateRobotOperation: async (data: RobotOperationVO) => {
    return await request.put({ url: `/health/robot-operation/update`, data })
  },

  // 删除运维工单
  deleteRobotOperation: async (id: number) => {
    return await request.delete({ url: `/health/robot-operation/delete?id=` + id })
  },

  // 导出运维工单 Excel
  exportRobotOperation: async (params) => {
    return await request.download({ url: `/health/robot-operation/export-excel`, params })
  },
}